
package Migue;

import java.util.Scanner;

public class Palindromo {
    public static void main(String[] args) {

        String palindromo[];
        
        Scanner esc= new Scanner(System.in);
        System.out.println("Introdusca dos palindromos: ");
        System.out.println("Introducir Primer palindromo: ");
        String entrada1 = esc.nextLine();
        

          palindromo =entrada1.split(" ");
          String str1="";
          String str2="";
          for(int x=0;x<palindromo.length;x++){
          str1+=palindromo[x];
          }
           char array[]= str1.toCharArray();
           for(int y=array.length-1;y>=0;y--){
           str2=str2+array[y];
          }
           System.out.println("----------------------------------\nLa primera frase es: ");
          if(str1.equals(str2)){
              System.out.println("Palindromo.\n");
          }else{
              System.out.println("No palindromo.\n");
          }
           String palindromo2[];
           System.out.println("Introducir Segundo palindromo: ");
           String entrada2 = esc.nextLine();
            palindromo2 =entrada2.split(" ");
          String str3="";
          String str4="";
          for(int x=0;x<palindromo2.length;x++){
          str3+=palindromo2[x];
          }
           char array2[]= str3.toCharArray();
           for(int y=array2.length-1;y>=0;y--){
           str4=str4+array2[y];
          }
           System.out.println("----------------------------------\nLa segunda frase es: ");
          if(str3.equals(str4)){
              System.out.println("Palindromo.");
          }else{
              System.out.println("No palindromo.");
          }
    }
}
